<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
		  <#assign base=request.contextPath  />
    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script src="${base}/js/jquery.min.js"></script>

    <style type="text/css">
        form{
            padding:20px;
        }
        .layui-btn-radius{
            border-radius: 5px;
        }
    </style>
</head>
<body>

<form class="layui-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;姓名</label>
            <div class="layui-input-inline">
                <input name="number" id="name" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;性别</label>
            <div class="layui-input-block">
                <input type="radio" name="sex"  value="男" title="男" >
                <input type="radio" name="sex" value="女" title="女" checked >
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >工号</label>
            <div class="layui-input-inline">
                <input name="number" id="workNumber"   autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;部门</label>
            <div class="layui-input-inline">
                <input name="number" id="dept" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;职务</label>
            <div class="layui-input-inline">
                <input name="number" id="postz" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;年龄</label>
            <div class="layui-input-inline">
                <input name="number" id="age" lay-verify="required|number"  autocomplete="off" class="layui-input isNull isNum" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;民族</label>
            <div class="layui-input-inline">
                <input name="number" id="nation" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;出生日期</label>
            <div class="layui-input-inline">
                <input name="date" id="date2" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;身份证号</label>
            <div class="layui-input-inline">
                <input name="number" id="idNumber" lay-verify="required|identity|number"  autocomplete="off" class="layui-input isNull isNo" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;婚否</label>
            <div class="layui-input-inline">
                <input name="number" id="marriage" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;联系电话</label>
            <div class="layui-input-inline">
                <input name="number" id="phone" lay-verify="required|phone|number"  autocomplete="off" class="layui-input isPhone" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;紧急联系人/电话</label>
            <div class="layui-input-inline">
                <input name="number" id="urgent" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;户口所在地</label>
            <div class="layui-input-inline">
                <input name="number" id="address" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;现住址</label>
            <div class="layui-input-inline">
                <input name="number" id="presentAddress" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;学历</label>
            <div class="layui-input-inline">
                <input name="number" id="education" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;毕业院校</label>
            <div class="layui-input-inline">
                <input name="number" id="graduation" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;专业</label>
            <div class="layui-input-inline">
                <input name="number" id="major" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >培训经历</label>
            <div class="layui-input-inline">
                <input name="number" id="trainingExperience" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >所获证书</label>
            <div class="layui-input-inline">
                <input name="number" id="obtainCertificate" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;入职日期</label>
            <div class="layui-input-inline">
                <input name="date" id="date" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;合同签订日期</label>
            <div class="layui-input-inline">
                <input name="date" id="date4" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;试用期截止时间</label>
            <div class="layui-input-inline">
                <input name="date" id="date3" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;合同到期日期</label>
            <div class="layui-input-inline">
                <input name="date" id="date5" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;合同签订次数</label>
            <div class="layui-input-inline">
                <input name="number" id="numberOfSigns" lay-verify="required|number"  autocomplete="off" class="layui-input isNull isNum" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >工龄</label>
            <div class="layui-input-inline">
                <input name="number" id="workingYears" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label"><a style="color:red">*</a>&nbsp;本公司参保时间</label>
            <div class="layui-input-inline">
                <input name="date" id="date6" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;开户行</label>
            <div class="layui-input-inline">
                <input name="number" id="accountOpening" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;银行卡号</label>
            <div class="layui-input-inline">
                <input name="number" id="bankNumber" lay-verify="required|number"  autocomplete="off" class="layui-input isNum isNull"  type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >异动</label>
            <div class="layui-input-inline">
                <input name="number" id="movement" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >渠道</label>
            <div class="layui-input-inline">
                <input name="number" id="channel" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" >备注</label>
            <div class="layui-input-inline">
                <input name="number" id="remarks" lay-verify=""  autocomplete="off" class="layui-input" type="text">
            </div>
        </div>
        <!-- <div class="layui-inline">
             <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;家庭住址</label>
                 <div class="layui-input-inline">
                      <input name="number" id="address" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                 </div>
         </div>-->




        <!-- <div class="layui-inline">
                <label class="layui-form-label">离职日期</label>
                   <div class="layui-input-inline">
                       <input name="date" id="date1" lay-verify="" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" type="text">
                   </div>
         </div>-->

        <!-- <div class="layui-inline">
              <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;岗位</label>
                    <div class="layui-input-inline">
                         <input name="number" id="post" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                    </div>
          </div>-->
        <!--<div class="layui-inline">
         <label class="layui-form-label"><a style="color:red">*</a>&nbsp;病历史</label>
         <div class="layui-input-inline">
           <input name="number" id="medicalRecord" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
         </div>-->


        <!-- </div>
            <div class="layui-inline">
                  <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;健康状态</label>
                          <div class="layui-input-inline">
                               <input name="number" id="healthStatus" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
                            </div>
                         </div>-->
        <!--<div class="layui-inline">
 <label class="layui-form-label"><a style="color:red">*</a>&nbsp;工作状态</label>
 <div class="layui-input-block" >
   <select  lay-verify="required" class="isNull" id="state">
     <option value="在职">在职</option>
     <option value="离职">离职</option>
     <option value="出差">出差</option>
     <option value="请假">请假</option>
     <option value="休假">休假</option>
   </select>
 </div>
</div>-->


        <div class="layui-form-item" style="text-align:center">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-radius" lay-submit lay-filter="formDemo" type="button" onclick="onSubmit()" style="background-color: #0092EF;" >立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
            </div>
        </div>
    </div>
</form>

<script>
    layui.use(['form', 'layedit', 'laydate','layer'], function(){
        var form = layui.form
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate;
        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });
        laydate.render({
            elem: '#date2'
        });
        laydate.render({
            elem: '#date3'
        });
        laydate.render({
            elem: '#date4'
        });
        laydate.render({
            elem: '#date5'
        });
        laydate.render({
            elem: '#date6'
        });

    });
    //添加
    function onSubmit(){
        if(!isNull()){
            return;
        }
        if(!isNum()){
            return;
        }

        if(!isPhone()){
            return;
        }
        if(!isNo()){
            return;
        }

//alert($('input:radio[name="sex"]:checked').val())
        var jsonData = {};
        //姓名
        jsonData.name = $("#name").val();
        //性别
        jsonData.sex = $('input:radio[name="sex"]:checked').val();
        //身份证号
        jsonData.idNumber = $("#idNumber").val();
        //家庭住址
        jsonData.address = $("#address").val();
        //年龄
        jsonData.age = $("#age").val();
        //手机号
        jsonData.phone = $("#phone").val();
        //出生年月
        jsonData.birth = $("#date2").val();
        //入职日期
        jsonData.dateEntry = $("#date").val();
        //暂定工号
        jsonData.workNumber = $("#workNumber").val();
        //工龄
        jsonData.workingYears = $("#workingYears").val();
        //部门
        jsonData.dept = $("#dept").val();
        //职务
        jsonData.postz = $("#postz").val();
        //婚否
        jsonData.marriage = $("#marriage").val();
        //民族
        jsonData.nation = $("#nation").val();
        //学历
        jsonData.education = $("#education").val();
        //毕业院校
        jsonData.graduation = $("#graduation").val();
        //专业
        jsonData.major = $("#major").val();
        //培训经历
        jsonData.trainingExperience = $("#trainingExperience").val();
        //获得证书
        jsonData.obtainCertificate = $("#obtainCertificate").val();
        //试用期截止时间
        jsonData.probationPeriod = $("#date3").val();
        //合同签订次数
        jsonData.numberOfSigns = $("#numberOfSigns").val();
        //合同签订日期
        jsonData.signing = $("#date4").val();
        //合同到期日期
        jsonData.ExpirationDate = $("#date5").val();
        //现住址
        jsonData.presentAddress = $("#presentAddress").val();
        //紧急联系人
        jsonData.urgent = $("#urgent").val();
        //开户银行
        jsonData.accountOpening = $("#accountOpening").val();
        //银行卡号
        jsonData.bankNumber = $("#bankNumber").val();
        //本公司参保时间
        jsonData.insurance = $("#date6").val();
        //异动
        jsonData.movement = $("#movement").val();
        //备注
        jsonData.remarks = $("#remarks").val();
        //渠道
        jsonData.channel = $("#channel").val();


        //离职日期
        //jsonData.leaveDate = $("#date1").val();
        //岗位
        //jsonData.post = $("#post").val();
        //病历史
        //jsonData.medicalRecord = $("#medicalRecord").val();
        //健康状态
        //jsonData.healthStatus = $("#healthStatus").val();
        //工作状态
        //jsonData.state = $("#state").val();
        $.ajax({
            type:"POST",
            url:"${base}/employeeFile/insert",
            data:{"param":JSON.stringify(jsonData)},
            success:function(data){

                //if(typeof(data.leaveDate)==="undefined"){
                //data.leaveDate=0;
                //}
                //alert("data.leaveDate:"+data.leaveDate);

                layer.msg("添加成功");



                setTimeout(function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                },800)
                //清空表格
                //姓名
                jsonData.name = $("#name").val("");
                //性别
                jsonData.sex = $('input:radio[name="sex"]:checked').val("");
                //身份证号
                jsonData.idNumber = $("#idNumber").val();
                //年龄
                jsonData.age = $("#age").val("");
                //家庭住址
                jsonData.address = $("#address").val("");
                //手机号
                jsonData.phone = $("#phone").val();
                //出生日期
                jsonData.birth = $("#date2").val("");
                //入职日期
                jsonData.dateEntry = $("#date").val("");
                //暂定工号
                jsonData.workNumber = $("#workNumber").val();
                //工龄
                jsonData.workingYears = $("#workingYears").val();
                //部门
                jsonData.dept = $("#dept").val();
                //职务
                jsonData.postz = $("#postz").val();
                //婚否
                jsonData.marriage = $("#marriage").val();
                //民族
                jsonData.nation = $("#nation").val();
                //学历
                jsonData.education = $("#education").val();
                //毕业院校
                jsonData.graduation = $("#graduation").val();
                //专业
                jsonData.major = $("#major").val();
                //培训经历
                jsonData.trainingExperience = $("#trainingExperience").val();
                //获得证书
                jsonData.obtainCertificate = $("#obtainCertificate").val();
                //试用期截止时间
                jsonData.probationPeriod = $("#date3").val();
                //合同签订次数
                jsonData.numberOfSigns = $("#numberOfSigns").val();
                //合同签订日期
                jsonData.signing = $("#date4").val();
                //合同到期日期
                jsonData.ExpirationDate = $("#date5").val();
                //现住址
                jsonData.presentAddress = $("#presentAddress").val();
                //紧急联系人
                jsonData.urgent = $("#urgent").val();
                //开户银行
                jsonData.accountOpening = $("#accountOpening").val();
                //银行卡号
                jsonData.bankNumber = $("#bankNumber").val();
                //本公司参保时间
                jsonData.insurance = $("#date6").val();
                //异动
                jsonData.movement = $("#movement").val();
                //备注
                jsonData.remarks = $("#remarks").val();
                //渠道
                jsonData.channel = $("#channel").val();
                //离职日期
                //jsonData.leaveDate = $("#date1").val("");
                //岗位
                //jsonData.post = $("#post").val("");
                //病历史
                //jsonData.medicalRecord = $("#medicalRecord").val("");
                //健康状态
                //jsonData.healthStatus = $("#healthStatus").val("");
                //工作状态
                //jsonData.state = $("#state").val("");
                var table = parent.layui.table;
                //表刷新方法
                table.reload('testReload', {
                    url: '${base}/employeeFile/select'
                    ,where: {} //设定异步数据接口的额外参数
                    //,height: 300
                });
            }
        });

    }


</script>
</body>
</html>
